<?php

class Application_Form_Login extends Zend_Form
{

    public function init()
    {
        /* Form Elements & Other Definitions Here ... */
    	$this->setMethod('post');
    	 
    	/* $this->addElement('text', 'email', array(
    			'label'      => 'Enter email:',
    			'required'   => true,
    			'filters'    => array('StringTrim'),
    			'validators' => array(
    					'EmailAddress',
    			)
    	)); */
    	
    	$this->addElement('text', 'mobile_tel', array(
    			'label'      => '手机号码:',
    			'required'   => true,
    			'filters'    => array('StringTrim'),
    			'validators' => array(
    					array('regex', false, '/^(13[0-9]|14[5|7]|15[0-9]|18[0-9])\d{8}$/')
    			)
    	));
    	
    	$this->addElement('password', 'password', array(
    			'label'      => '登录密码:',
    			'required'   => true,
    			'validators' => array(
    					array('validator' => 'StringLength', 'options' => array(0, 32))
    			),
    			'message' =>'error'
    	));
    	
    	
    	 $this->addElement('captcha', 'captcha', array(
    	 		'label'      => '验证码（不区分大小写）:',
    	 		'required'   => true,
    	 		'captcha'    => array(
    	 				'captcha' => 'Image',
    	 				'font' => APPLICATION_PATH . '\..\design\fonts/STENCILSTD.OTF',
    	 				'imgDir'=> APPLICATION_PATH . '\..\var\cache\image\captcha',
    	 				'imgUrl'=>'/box/var/cache/image/captcha',
    	 				'wordLen' => 5,
    	 				'timeout' => 300
    	 		)
    	 ));
    	 
    	$this->addElement('submit', 'submit', array(
    			'ignore'   => true,
    			'label'    => '登录',
    	));
    	 
    	// And finally add some CSRF protection
    	$this->addElement('hash', 'csrf', array(
    			'ignore' => true,
    	));
    	
    	$this->setDecorators(array(//error info
    			'FormElements',
    			array('HtmlTag', array('tag' => 'dl', 'class' => 'zend_form')),
    			array('Description', array('placement' => 'prepend')),
    			'Form'
    	));
    	
    	
    }


}

